﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DesignPatterns.SimpleFactory
{
    public partial class FrmSimpleFactory : FrmBase
    {
        public FrmSimpleFactory()
        {
            InitializeComponent();

            cmbOperate.SelectedIndex = 0;

            btnCalc.Click += BtnCalc_Click;
        }

        private void BtnCalc_Click(object sender, EventArgs e)
        {
            var operate = OperationFactory.CreateOperation(cmbOperate.Text);
            operate.NumberA = nudNumberA.Value;
            operate.NumberB = nudNumberB.Value;
            labResult.Text = operate.GetResult().ToString();
        }
    }
}
